package com.study.langchain4j.api.rag;

import dev.langchain4j.data.document.loader.FileSystemDocumentLoader;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author xl-9527
 * @since 2025/11/7
 */
@RestController
@RequestMapping("ai/rag")
public class RagApi {

    /**
     * 读取文件并且上传到 vector db
     */
    @PostMapping("upload/doc")
    public void uploadDoc(MultipartFile file) throws IOException {
        // TODO: 2025/11/7
        FileSystemDocumentLoader.loadDocument(file.getResource().getFile().getPath());
    }
}
